package com.rabbiter.market.common.rabbitmq;

import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author: longxianghang
 * @date: 2025/4/16 16:15
 * @description:
 */
public class OrderProcessor {

    public static MessagePostProcessor messagePostProcessor(String time){
        return  new MessagePostProcessor() {
            @Override
            public Message postProcessMessage(Message message) throws AmqpException {
                //设置有效期30分钟
                //message.getMessageProperties().setExpiration("1800000");
                message.getMessageProperties().setExpiration(time);
                return message;
            }
        };
    }
}
